package com.dailyblue.example.project.bookstore.commons.util;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
public class JsonResult<T> implements Serializable {

    private T data;
    private Boolean success;
    private Integer code;
    private String errorMessage;

    public JsonResult(T data) {
        this.success = true;
        this.code = 200;
        this.data = data;
    }

    public JsonResult(int code, String message) {
        this.code = code;
        this.errorMessage = message;
    }
}

